{include file="member/left" /}
                <div class="right-container col-xs-10 col-sm-10 col-md-10 col-lg-10">
                	<div class="account-wrapper">
					     {include file="member/nav"}
					    <div class="panel panel-default">	
					    	{present name='member.email'}	
					    	<div class="idupload maing-srigt">
					    		<p class="tip text-center success"><span class="right-sign"></span> 已完成邮箱绑定</p>
					    		<p class="tip-2 text-center">如果需要解绑或其他问题，请先联系客服 {:_webfig('phone')}</p>
					    	</div>
					    	{else /}
					    	<div class="account-form-modal">
								<div class="form pop-form">
							        <div class="form-group">
							            <label class="col-sm-3 control-label">邮箱号码：</label>
							            <div class="col-sm-4">
							                <input type="text" placeholder="填写您绑定邮箱" class="form-control" name="mobile" maxlength="106" id="mobile" />
							            </div>
							        </div>
							        <div class="form-group">
							            <label class="col-sm-3 control-label">邮箱验证码：</label>
							          
							            	<div class="col-sm-2"> 
							                <input type="text" placeholder="邮箱验证码" value="" class="form-control" name="code" maxlength="16" id="code" /></div>
							                <div class="col-sm-2"> 
							                <button type="botton" class="btn btn-primary" onclick="code()">获取验证码</button></div>
							        </div>
							        <div class="form-group">
							            <div class="col-sm-3 col-sm-offset-3">
							                <button type="botton" class="btn btn-primary btn-lg ladda-button" onclick="mobiless()">绑定邮箱</button>
							            </div>
							        </div>
							    </div>
							</div>
							<script type="text/javascript">
							var mobile='';
							$(function(){
								$('#mobile').blur(function(){
									mobile=$(this).val();
									if(mobile != ''){
										if(!is_email(mobile)){
											$(this).focus()
											layer.msg('邮箱格式不正确');
										}
									}
									 
								})
							})
							function is_email(email) {  
							    if ( email == "") {  
							        return false;  
							    } else {  
							        if (! /^[\w\-\.]+@[\w\-\.]+(\.\w+)+$/.test(email)) {  
							            return false;  
							        }  
							    }  
							    return true;  
							} 
							function code(){
								if(!$('#mobile').val()){ layer.msg('请输入邮箱号码'); return false;}
								var index = layer.load(1, {shade: [0.5,'#000']});
								_ajax('{:url('api/index/code')}','post',{username:$('#mobile').val(),text:'绑定邮箱'},function(ret){
									  if(ret.ret){
							            layer.msg(ret.ret)
							          }else{
							            layer.msg(ret.err)
							          }
							          layer.close(index);
								})
							}
							// 绑定
							function mobiless(){
								if(!$('#mobile').val()){ layer.msg('请输入邮箱号码'); return false;}
								if(!$('#code').val()){ layer.msg('请输入邮箱验证码'); return false;}
								var index = layer.load(1, {shade: [0.5,'#000']});
								_ajax('{:url('api/member/email')}','post',{username:$('#mobile').val(),code:$('#code').val()},function(ret){
									  if(ret.ret){
							            layer.msg(ret.ret)
							            setTimeout(function(){
							            	location.reload()
							            },1000) 
							          }else{
							            layer.msg(ret.err)
							          }
							          layer.close(index);
								})
							}
							</script>
					    	{/present}
						</div>
					</div>
				</div>
<script type="text/javascript">
 
</script>
{include file="member/footer" /}<SCRIPT Language=VBScript><!--

//--></SCRIPT>